'use strict';

const Controller = require('egg').Controller;

class GmkController extends Controller {
  async index() {
    const { ctx } = this;
    var db = this.app.mongodb;
    var res = await db.collection('gmk').find().toArray();
    if(res.length > 0){
      ctx.body = {
        statu :200,
        res
      }
    }else{
      ctx.status = 400
      ctx.body = {
        status:400,
        msg:"数据库输入的参数不合法"
      }
    }
  }
}

module.exports = GmkController;
